//
//  SISSLoginNetworkingManager+Map.m
//  SISSAPP
//
//  Created by 优房网 on 2017/6/6.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSLoginNetworkingManager+Map.h"

@implementation SISSLoginNetworkingManager (Map)

// 2.10.1 地图筛选房源大区
- (void)requestFilterMapHouseRegionResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_HOUSE_REGION parameters:params success:^(id responseObject) {
        NSLog(@"2.10.1 地图筛选房源大区: responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];

}

// 2.10.2 地图筛选客源大区
- (void)requestFilterMapPassengerRegionResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_PASSENGER_REGION parameters:params success:^(id responseObject) {
        NSLog(@"2.10.2 地图筛选客源大区: responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *passengerResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(passengerResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 2.10.3 地图筛选出租区域套数
- (void)requestFilterMapRentOutRegionResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_RENTOUT_REGION parameters:params success:^(id responseObject) {
        NSLog(@"2.10.3 地图筛选出租区域套数: responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 2.10.4 地图筛选租客区域套数
- (void)requestFilterMapTenantRegionResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_TENANT_REGION parameters:params success:^(id responseObject) {
        NSLog(@"2.10.4 地图筛选租客区域套数: responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 2.11.1 地图筛选房源小区（街道办）
- (void)requestFilterMapHouseRegionDetailResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_HOUSE_REGION_DETAIL parameters:params success:^(id responseObject) {
        NSLog(@"2.11.1 地图筛选房源小区（街道办）: responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 2.11.2 地图筛选客源小区（街道办)
- (void)requestFilterMapPassengerRegionDetailResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_PASSENGER_REGION_DETAIL parameters:params success:^(id responseObject) {
        NSLog(@"2.11.2 地图筛选客源小区（街道办): responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *passengerResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(passengerResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 2.11.3 地图筛选出租街道办套数（街道办）
- (void)requestFilterMapRentOutRegionDetailResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_RENTOUT_REGION_DETAIL parameters:params success:^(id responseObject) {
        NSLog(@"2.11.3 地图筛选出租街道办套数（街道办）: responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
    
}

// 2.11.4 地图筛选租客街道办套数（街道办)
- (void)requestFilterMapTenantRegionDetailResourceWithParameters:(NSDictionary *)parameters success:(void (^)(NSArray<SISSMapAreaModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameter = @{
                                @"spId":@([SISSUserAccount shared].sp_id),
                                @"saId":@([SISSUserAccount shared].sa_id),
                                @"soId":@([SISSUserAccount shared].so_id),
                                @"sobId":@([SISSUserAccount shared].sob_id)
                                };
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
    [params addEntriesFromDictionary:parameters];
    
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_TENANT_REGION_DETAIL parameters:params success:^(id responseObject) {
        NSLog(@"2.11.4 地图筛选租客街道办套数（街道办): responseObject-->%@",responseObject);
        
        if ([responseObject[@"result"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *houseResourceArr = [NSArray yy_modelArrayWithClass:[SISSMapAreaModel class] json:dataArr];
        if (successBlock) {
            successBlock(houseResourceArr);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 2.12.1 根据展示各级别地图上统计房价信息
- (void)requestFilterMapEvaluationStatisticsResourceWithParameters:(NSDictionary *)parameters success:(void (^)(id responseObject))successBlock failed:(void (^)(NSError *))failedBlock {
    [kLoginNetworkingManager POSTWithURLString:URL_MAP_EVALUATION_STATISTICS parameters:parameters success:^(id responseObject) {
        NSLog(@"2.12.1 根据展示各级别地图上统计房价信息: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
            return;
        }
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } faile:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}
@end
